import axios from 'axios'
import Vue from 'vue'
// import router from '../router'
const url = {
  services: 'http://101.42.233.226:8060/',
}
const service = axios.create({
  baseURL: url.services,
  timeout: 2000000
})

// // 请求拦截
service.interceptors.request.use(config => {
  // if (router.history.current.fullPath === '/login') { return config } else {
  // console.log(role)
  config.headers.token = localStorage.getItem("cxLoginTToken")
  // }
  return config
}, err => {
  return Promise.reject(err)
})

// 响应拦截
service.interceptors.response.use(res => {
  return res
}, err => {
  return Promise.reject(err)
})

export default service

Vue.prototype.$axios = axios
